package com.jxau.mall.common.config;

import com.jxau.mall.common.interceptor.AuthorizationInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @program: shop
 * @description: 注册拦截器工具类
 * @author: guojiani
 * @create: 2025-04-24 21:34
 **/
@Configuration
public class WebConfig implements WebMvcConfigurer {
    /**
     * 注册拦截器，可以注册多个拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new AuthorizationInterceptor())
                .addPathPatterns("/**") // 拦截所有地址
                .excludePathPatterns("/login","/user/register","/goods/**");// 排除拦截
    }
}
